/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: YCKOKO
 * Date: 2022-10-13
 * Time: 15:31
 */
/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: YCKOKO
 * Date: 2022-10-13
 * Time: 15:17
 */
class Student4{
    private String name;
    private int age;
    public Student4(){
        System.out.println("调用无参构造方法");
    }

    public Student4(String n){
        name = n;
        System.out.println("调用一个参数的构造方法");
    }
    public Student4(String n,int a){
        name = n;
        age = a;
        System.out.println("调用两个参数的构造方法");
    }
    public void read(){
        System.out.println("你好！我叫"+name+",今年"+age);
    }
}
public class demo7 {
    public static void main(String[] args) {
        Student4 stu1 = new Student4();
        stu1.read();
        System.out.println("=======================");
        Student4 stu2 = new Student4("小杨");
        stu2.read();
        System.out.println("=======================");
        Student4 stu3 = new Student4("小杨",18);
        stu3.read();
        System.out.println("=======================");
        stu1.read();
        System.out.println("=======================");
    }
}
